package com.nami.conver.application.grpmsg;

import com.nami.conver.application.convertor.Cmd2DomainConvertor;
import com.nami.conver.domain.gchat.service.GrpConverDomainService;
import com.nami.conver.domain.pchat.model.UpdConverModel;
import com.nami.conver.facade.grpmsg.GrpConverFacade;
import com.nami.conver.facade.grpmsg.request.GrpConverCmd;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class GrpConverFacadeImpl implements GrpConverFacade {

    private final GrpConverDomainService converService;

    @Override
    public void execute(GrpConverCmd cmd) {
        // 1. 校验参数
        // TODO
        // 2. 转换
        UpdConverModel conver = Cmd2DomainConvertor.toDomain(cmd);
        // 3. 更新会话
        // doRefresh 非领域命名，方法命名应揭示意图，do属于技术细节
        converService.refreshConvers(conver);
    }

}
